package logica;

import javax.swing.JProgressBar;

public class SimpleThread extends Thread {
	private JProgressBar barra;
	
   public SimpleThread (String str, JProgressBar progressBar) { 
      super(str);
      barra=progressBar;
   }
   public void run() { // Sobrecargando al metodo run
	   int ciclo=0;
	   
	   barra.setString("Guardando...");
	   
       while(true){
    	   barra.setValue(ciclo++);
    	  try {
			SimpleThread.sleep(50);
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		if(ciclo>100) {ciclo=0;}
		
    	 
      }     
      
   }
   public void parar(){
	   this.stop();
	   barra.setValue(100);
	   barra.setString("Guardado");
	   
	   
	   
   }
}
